<template>
  <div class="common-layout">
    <el-container class="lay-container">
      <Common-aside />
      <el-container class="r-container">
        <Common-header />
        <Common-tab />
        <el-main class="right-main">
          <!-- <router-view /> -->
          <router-view v-slot="{ Component, route }">
            <keep-alive v-if="Component">
              <component
                :is="Component"
                :key="route.name"
                v-if="route.meta.keepAlive"
              ></component>
            </keep-alive>
            <component
              :is="Component"
              :key="route.name"
              v-if="!route.meta.keepAlive"
            ></component>
          </router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
// defineComponent用于定义组件的函数，它将组件选象转换为一个符合 Vue 组件规范的对象，用于构建 Vue 3 组件。
import { defineComponent } from "vue";
// 动态导入了 CommonHeader 组件
import CommonHeader from "../components/CommonHeader.vue";
import CommonAside from "../components/CommonAside.vue";
import CommonTab from "../components/CommonTab.vue";
export default defineComponent({
  // 注册组件
  components: {
    CommonHeader,
    CommonAside,
    CommonTab,
  },
});
</script>

<style lang="less" scoped>
// .el-container {
//   // flex-wrap属性表示容器内元素的换行/拆行与否
//   flex-wrap: wrap;
//   align-items: flex-start;
//   height: 100%;
// }
.r-container {
  flex-wrap: wrap;
}
.el-container {
  flex-wrap: wrap;
  align-items: flex-start;
  height: 100%;
}
.common-layout {
  height: 100%;
  .lay-container {
    flex-wrap: nowrap;
    .right-main {
      height: calc(100% - 100px) !important;
    }
  }
  & > .el-container {
    height: 100%;

    & > .el-aside {
      height: 100%;
      background: #0356d0;
      // box-shadow: -6px -6px 6px rgba(0, 0, 0, 0.4);
    }
  }
}
.el-main {
  padding-top: 10px;
}
// #0452c3
</style>
